/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: TemplateClient
 * Author:   zhouheng
 * Date:     2019/5/1 21:15
 * Description: 模板方法客户端
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zhouh.patterns.com.zhouh.action.template;

import com.zhouh.patterns.com.zhouh.action.strategy.*;
import com.zhouh.patterns.com.zhouh.create.factory.factoryMethod.AppleFactory;
import com.zhouh.patterns.com.zhouh.create.factory.factoryMethod.BananaFactory;
import com.zhouh.patterns.com.zhouh.create.factory.factoryMethod.FruitFactory;
import com.zhouh.patterns.com.zhouh.create.factory.factoryMethod.OrangeFactory;
import com.zhouh.patterns.com.zhouh.entity.Fruit;
import com.zhouh.patterns.com.zhouh.entity.fruit.Banana;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 〈一句话功能简述〉<br> 
 * 〈模板方法客户端〉
 *
 * @author zhouheng
 * @create 2019/5/1
 * @since 1.0.0
 */
public class TemplateClient {
    private static Map<String,Discount> disCounts = new HashMap();
    static {
        disCounts.put("full",new FullDiscount());
        disCounts.put("newer",new NewerDiscount());
        disCounts.put("second",new SecondDiscount());
    }

    public static void main(String[] args){
        List<Fruit> fruits = new ArrayList<>();

        fruits.add(new AppleFactory().getFruit());
        fruits.add(new OrangeFactory().getFruit());
        fruits.add(new BananaFactory().getFruit());

        CashShoppingCart cashShoppingCart = new CashShoppingCart(fruits);
        cashShoppingCart.setDiscount(new OldCustomerDiscount());
        cashShoppingCart.submitOrder();
    }
}